<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>订单</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../css/main.css">
			<style type="text/css">
			</style>
	</head>
	<body>
		<div class="list_header">
			<h1 class="">订单</h1>
		</div>
		<!--下拉刷新容器-->
		<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
			<!--<div class="mui-scroll">
				<!--数据列表
				<ul class="mui-table-view mui-table-view-chevron">
					
				</ul>
			</div>-->
			<div class="mui-content-padded " id="project">
	</div>
		</div>
		<ul class="list_bottom_menu" >
			<li class="">
				<a href="../../index.html" id="writeOff">
					<div class="index_menu_btn">
						<span class="btn btn_4"><img src="../images/writeOff_icon.png" class="img_1"/></span>
					</div>
					<div class="index_menu_text">核销</div>
				</a>
			</li>
			<li class="current">
				<a href="javascript:void(0);" id="order">
					<div class="index_menu_btn">
						<span class="btn btn_5"><img src="../images/order_icon.png" class="img_1"/></span>
					</div>
					<div class="index_menu_text">订单</div>
				</a>
			</li>
			<li class="">
				<a href="account.html" id="account">
					<div class="index_menu_btn">
						<span class="btn btn_6"><img src="../images/user_icon.png" class="img_1"/></span>
					</div>
					<div class="index_menu_text">账户</div>
				</a>
			</li>
		</ul>
		<div class="order_detail">
			<div class="mui-content-padded">
				<div class=" item_data item_data_f">
					<div class="order_list order_title">
						<div class="c_l orders_title">贝克熊乐园门票</div>
						<span class="c_r orders_num">x<span></span></span>
					</div>
					<div class="order_list order_content">
						<div class="data_item">
							<div class="c_l orders_sn" >订单号:<span></span></div>
							<span class="c_r orders_peyFee">支付:<span></span>元</span>
						</div>
						<div class="data_item">
							<div class="c_l orders_phoneNum"><span></span></div>
							<span class="c_r orders_coupons">红包:<span></span>元</span>
						</div>
					</div>
					<div class="order_list order_bottom">
						<div class="c_l orders_addTime"><span></span></div>
						<span class="c_r orders_totalFee">总金额:<span></span>元</span>
					</div>
					<div class="mui-content-padded">
						<ul class="mui-table-view order_detail_list" >
							<li class="mui-table-view-cell before_list">
									<span class="o_l">验证码</span><span class="o_r">使用状态</span>
							</li>
							
						</ul>
						<div class="order_detail_rule orders_goodsDesc">
							
						</div>
					</div>
					<button id='goback' class="mui-btn mui-btn-block mui-btn-primary login_btn goback_btn">返回</button>
				</div>
			</div>
		</div>
		<script src="../js/mui.min.js"></script>
		<script src="../js/jquery-2.1.4.min.js"></script>
		<script src="../js/jquery.cookie.js"></script>
		<script>
			mui.init({
					swipeBack:true, //启用右滑关闭功能
	statusBarBackground: '#333543',
				pullRefresh: {
					container: '#pullrefresh',
					down: {
						//callback: pulldownRefresh
					},
					up: {
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				},
                gestureConfig: { //手势开启
                    tap: true,
                    longtap: true,
                    swipe: true
                }
			});
			/**
			 * 下拉刷新具体业务实现
			 */
			function pulldownRefresh() {
				setTimeout(function() {
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					for (var i = cells.length, len = i + 3; i < len; i++) {
						var li = document.createElement('li');
						li.className = 'mui-table-view-cell';
						li.innerHTML = '<a class="mui-navigate-right">Item ' + (i + 1) + '</a>';
						//下拉刷新，新纪录插到最前面；
						table.insertBefore(li, table.firstChild);
					}
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
				}, 1500);
			}
			var counts = 0;
			/**
			 * 上拉加载具体业务实现
			 */
			function pullupRefresh() {
				setTimeout(function() {
				mui('#pullrefresh').pullRefresh().endPullupToRefresh((++counts > 20)); //参数为true代表没有更多数据了。
				upPullrefresh();
				}, 1500);
			}
			if (mui.os.plus) {
				mui.plusReady(function() {
					setTimeout(function() {
						mui('#pullrefresh').pullRefresh().pullupLoading();
					}, 1000);

				});
			} else {
				mui.ready(function() {
					mui('#pullrefresh').pullRefresh().pullupLoading();
				});
			}

			function order_detail(order_id){
				$(".order_detail_list .before_list").siblings().remove();
			         	$.ajax({
					url:"http://123.57.148.137:8080/api/v1/vender_admin/order/detail",
					data:{
						"order_id":order_id,
						"login_name":$.cookie('login_name'),
						"auth_token":$.cookie('token')
					},
					type:'post',
					success:function(data){
						if(data.errno == 0){
							$(".order_detail").fadeIn();
							var order_info = data.data.order_info;
							var verify_info = data.data.order_verify_info;
							var goods_desc = data.data.goods_desc ;
							$(".orders_title").text(order_info.goods_name);
							$(".orders_num span").text(order_info.goods_number);
							$(".orders_sn span").text(order_info.order_sn);
							$(".orders_peyFee span").text(order_info.pay_fee);
							$(".orders_phoneNum span").text(order_info.mobile);
							$(".orders_coupons span").text(order_info.coupons_money);
							$(".orders_addTime span").text(order_info.add_time);
							$(".orders_totalFee span").text(order_info.total_fee);
							$(".orders_goodsDesc span").text(goods_desc.html_desc);

							$.each(verify_info, function(index,res){
															
						       var trs = "";   
									trs += "<li class='mui-table-view-cell'><span class='orders_verifySn'>"+res.verify_sn+"</span><span class='orders_verifyStatus'></span></li>";
						             //tbody += trs;         
						             $(".order_detail_list").append(trs);  
						       if(verify_info.verify_status==1){
									$(".orders_verifyStatus").text("已使用");
								}else{
									$(".orders_verifyStatus").addClass("no_used").text("未使用");
								}
						           
						         });  
						         i+=count;
						}else{
							alert(data.errmsg);
						}
					}
				});

			         }
			var i = 0;
			var count = 10;
			function upPullrefresh(){
			
				$.ajax({
					url:"http://123.57.148.137:8080/api/v1/vender_admin/order/list",
					data:{
						"start": i,
						"count":count,
						"login_name":$.cookie('login_name'),
						"auth_token":$.cookie('token')
					},
					type:'post',
					success:function(data){
						if(data.errno == 0){
							var obj = data.data.order_list ;
							$.each(obj, function(index,res){
						       var trs = "";  
						             trs += "<div class='data_item' order_id="+res.order_id+" ><a href='javascript:void(0);' class='order_list_btn'><div class='order_list order_title'><div class='c_l'>" +res.goods_name+"</div><span class='c_r'>x" + res.goods_number +"</span></div><div class='order_list order_content'><div class='data_item'><div class='c_l'>订单号:"+res.order_sn+"</div><span class='c_r'>支付:"+res.pay_fee+"</span></div><div class='data_item'><div class='c_l'>电话:"+res.mobile+"</div><span class='c_r'>红包:"+res.coupons_money+"</span></div></div><div class='order_list order_bottom'><div class='c_l'>"+res.add_time+"</div><span class='c_r'>总金额:"+res.total_fee+"元</span></div></a></div>";
						             //tbody += trs;         
						             $("#project .mui-pull-bottom-pocket").before(trs);  
						         });  
						         i+=count;
						}else{
							alert(data.errmsg);
						}
					}
				});
			}
		</script>
	</body>

</html>